/***************************************************************************
 *   Copyright (C) 2007 by shinda   *
 *   shinda@babaflex   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/


#include <QtGui>
#include "toshkhanna.h"
#include "search.h"
#include "shabadview.h"
#include <cstdio>

#include <QTextEdit>
#include <QTextStream>
#include <QCloseEvent>
#include <QFileDialog>
#include <QSplitter>
#include <QTabWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QLabel>
#include <QButtonGroup>
#include <QRadioButton>
#include <QComboBox>
#include <QListWidget>
#include <QFont>
#include <QByteArray>
#include <QTableView>
toshkhanna::toshkhanna()
{
	//Set the Main Font


	searchBox = new SearchWidget();
	//Search mainSearch();
	txtPaathi = new QTextEdit;
//	txtClassic = new QTextEdit;
	shabadView = new ShabadView();
	tblMeanings = new QTableView;
	sideTabs = new QTabWidget;
	viewTabs = new QTabWidget;

	sideTabs->setTabPosition ( QTabWidget::West );

	
	//Search Box
	sideTabs->addTab ( searchBox->searchBox, tr ( "Search" ) );
	//sideTabs->addTab(, tr ("History") );
	//sideTabs->addTab(, tr ("Bookmarks"));

	splitter = new QSplitter;
	splitter->addWidget ( sideTabs );
	
	//View Modes
	viewTabs->addTab ( shabadView->splDivider, tr( "Classic" ) );
	viewTabs->addTab ( txtPaathi, tr( "Paathi" ) );
	viewTabs->addTab ( tblMeanings, tr( "Vadhiyaarti" ));

	splitter->addWidget ( viewTabs );
	setCentralWidget ( splitter );

	createMenus();
	createStatusBar();

//	mainSearch->searchBani("SELECT Gurmukhi FROM Shabad WHERE FirstLetterStr LIKE '%108,113,107%';");

	setConnections();
}

void toshkhanna::getShabad(int value){
	qDebug() << "Shabad Value is " << value;
}

void toshkhanna::setConnections()
{
	connect (searchBox, SIGNAL ( shabadSelect(int ) ), shabadView, SLOT ( loadShabad( int ) ) );
}

void toshkhanna::createMenus()
{
	fileMenu = menuBar()->addMenu ( tr ( "&File" ) );

	menuBar()->addSeparator();

	editMenu = menuBar()->addMenu ( tr ( "&Edit" ) );
	menuBar()->addSeparator();

	helpMenu = menuBar()->addMenu ( tr ( "&Help" ) );
}


void toshkhanna::createStatusBar()
{
	statusBar()->showMessage ( tr ( "Ready" ) );
}

toshkhanna::~toshkhanna()
{
}


